package pkg.filter;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.Query;
import java.util.ArrayList;
import java.util.List;
import pkg.dao.Filter;
import pkg.entity.User;

public class UserFilter extends Filter {

    public String email;

    @Override
    public List getElements(Objectify ofy) {
        Query<User> query = ofy.query(User.class);
        if (email != null) {
            query.filter("email = ", email);
        }

        List<User> entities = new ArrayList<User>();
        for (User e : query) {
            entities.add(e);
        }
        return entities;
    }

    @Override
    public int getCount(Objectify ofy) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setSimple(String filterText) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public void setEmail(String email) {
        this.email = email;
    }

}
